package com.community.process._1010.dao.entity;

import com.baomidou.mybatisplus.annotation.TableName;
import com.community.process._1010.common.base.BaseEntity;
import com.community.process._1010.common.utils.mp.BaseTreeNode;
import com.community.process._1010.domains.ProcessCategoryDTO;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.io.Serializable;

/**
 * 到餐加工分类
 *
 * @author Zbs
 * @since 2024-09-05
 */
@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
@TableName("yg_process_category")
@Schema(description = "到餐加工分类")
public class ProcessCategory extends BaseTreeNode implements Serializable {
    private static final long serialVersionUID = 1L;

    @Schema(description = "分类名称")
    private String name;

    @Schema(description = "分类类型 1 食材 2 菜品")
    private Integer type;

    @Schema(description = "图标")
    private String icon;

    @Schema(description = "排序")
    private Integer sort;

    public ProcessCategory(ProcessCategoryDTO.CategoryAdd dto, Integer level, String treeCode) {
        super(level, dto.getParentId(), treeCode);
        this.name = dto.getName();
        this.icon = dto.getIcon();
        this.sort = dto.getSort();
        this.type = dto.getType();
    }
}
